
//6ifgUskw_Wywfw-DdvvC3Y8I7QLucFJxGa_36wjQCr6vYaJ60Qj4SRcWdTWFdoiesIQWZMR7M13t7e6p5UnBxFijVWAOLKCk_VweHKv0mHHn02os9IjcRF7VO7Ee6tvGkeVdtCAqvCgYUsMo_XIgIA


var app_id = "wx0692fa375d68142f";
var app_secret = "889ba2cae0b27043dbcf3b5520c05a5a";
var access_token = "6ifgUskw_Wywfw-DdvvC3Y8I7QLucFJxGa_36wjQCr6vYaJ60Qj4SRcWdTWFdoiesIQWZMR7M13t7e6p5UnBxFijVWAOLKCk_VweHKv0mHHn02os9IjcRF7VO7Ee6tvGkeVdtCAqvCgYUsMo_XIgIA";
var code = "112";
//https://api.weixin.qq.com/sns/oauth2/access_token?appid=自己写&secret=自己写&code=上面code&grant_type=authorization_code;


$(document).ready(function() {
});


$("#btn_call").click(function() {

	if (!checkInfo()) {
		return;
	}
	
	var json = {
			txt_user : $("#txt_user").val(),
			txt_phone : $("#txt_phone").val(),
			txt_customer : $("#txt_customer").val(),
			txt_time : $("#txt_time").val(),
			txt_memo : $("#txt_memo").val(),
	};
	
	$.ajax({
		type : "POST",// 请求方式
		url : "http://zhaoweiserver.sinaapp.com/order",// 发送请求地址
		data : JSON.stringify(json),
		dataType : "json",
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			alert("请求失败");
		},
		success : function(data, textStatus) {
			
			alert("预定成功！浏览器登录http://zhaoweiserver.sinaapp.com/console/yuyue/yuyue.jsp查看");
		},
		complete : function(XMLHttpRequest, textStatus) {
		}
	});
});

function checkInfo() {

	if ($("#txt_user").val() == "") {
		alert("请填写联系人！");
		return false;
	}

	if ($("#txt_phone").val() == "") {
		alert("请填写联系电话！");
		return false;
	}
	if ($("#txt_customer").val() == "") {
		alert("请输入人数");
		return false;
	}
	if ($("#txt_time").val() == "") {
		alert("请输入时间");
		return false;
	}
	return true;

}
